import { defineStore } from 'pinia'
import en from "@/locale/en.js";
import zhCn from "@/locale/zh-cn.js";

export const i18nStore = defineStore('i18n', {
  // 动作
  actions: {
    setI18n () {
      this.fy = this.language === 'zh-cn' ? zhCn.lang : en.lang;
    },
    setLanguage (str) {
      this.language = str;
      this.setI18n()
    }
  },
  // 状态
  state () {
    return {
      // 国际化标识
      language: '',
      // 国际化对象
      fy: {}
    }
  },
  // 计算
  getters: {}
})